<template>
{{#if page.psSysPFPlugin}}
    {{> @macro/plugins/view/view-use.hbs appPlugin=page.psSysPFPlugin}}
{{else}}
    {{#if page.psViewLayoutPanel.useDefaultLayout}}
    <AppLayoutLeft v-if="store.mainMenuPosition == 'LEFT'" :class="classNames">
        <template #appHeaderLeft>
            {{#if page.showCaptionBar}}
            <div class="app-header__left__logo">
                <AppIconText v-if="store.showLogo" :imgPath="model.appIconPath"></AppIconText>
                {{> @macro/view/view-caption.hbs}}
            </div>
            {{/if}}
        </template>
        <template #appHeaderCenter>
            <AppBreadCrumb v-if="store.showBreadCrumb"></AppBreadCrumb>
        </template>
        <template #appHeaderRight>
            <AppOrgSector v-if="store.showOrgSelect"></AppOrgSector>
            <AppLang v-if="store.showLang"></AppLang>
            <AppTheme v-if="store.showThemeSetting"></AppTheme>
            <AppUser v-if="store.showUserInfo"></AppUser>
            <AppLockScreen v-if="store.showLockScreen"></AppLockScreen>
            <AppFullScreen v-if="store.showFullScreen"></AppFullScreen>
            <AppMessagePopover v-if="store.showNotice"></AppMessagePopover>
        </template>
        <template #default>
        {{#each page.ctrls as | ctrl |}}
        {{#eq ctrl.controlType 'APPMENU'}}
            {{> @macro/widgets/menu-detail/menu.hbs ctrl=ctrl props=":mode='store.mainMenuPosition'"}}
        {{/eq}}
        {{/each}}
        </template>
        <template #tabPageExp v-if="store.showTabPageExp">
            <TabPageExp></TabPageExp>
        </template>
        <template #navPos>
            <AppNavPos></AppNavPos>
        </template>
        <template #appFooter>
            <AppCopyRight>{{#if page.bottomInfo}}{{page.bottomInfo}}{{/if}}</AppCopyRight>
        </template>
    </AppLayoutLeft>
    <AppLayoutTop v-else :class="classNames">
        <template #appHeaderLeft>
            {{#if page.showCaptionBar}}
            <div class="app-header__left__logo">
                <AppIconText v-if="store.showLogo" :imgPath="model.appIconPath"></AppIconText>
                {{> @macro/view/view-caption.hbs}}
            </div>
            {{/if}}
        </template>
        <template #appHeaderRight>
            <AppOrgSector v-if="store.showOrgSelect"></AppOrgSector>
            <AppLang v-if="store.showLang"></AppLang>
            <AppTheme v-if="store.showThemeSetting"></AppTheme>
            <AppUser v-if="store.showUserInfo"></AppUser>
            <AppLockScreen v-if="store.showLockScreen"></AppLockScreen>
            <AppFullScreen v-if="store.showFullScreen"></AppFullScreen>
            <AppMessagePopover v-if="store.showNotice"></AppMessagePopover>
        </template>
        <template #default>
        {{#each page.ctrls as | ctrl |}}
        {{#eq ctrl.controlType 'APPMENU'}}
            {{> @macro/widgets/menu-detail/menu.hbs ctrl=ctrl props=":mode='store.mainMenuPosition'"}}
        {{/eq}}
        {{/each}}
        </template>
        <template #tabPageExp v-if="store.showTabPageExp">
            <TabPageExp></TabPageExp>
        </template>
        <template #navPos>
            <AppNavPos></AppNavPos>
        </template>
        <template #appFooter>
            <AppCopyRight>{{#if page.bottomInfo}}{{page.bottomInfo}}{{/if}}</AppCopyRight>
        </template>
    </AppLayoutTop>
    {{else}}
    <div :class="classNames">
        {{#if page.psViewLayoutPanel.rootPSPanelItems}}
        {{#each page.psViewLayoutPanel.rootPSPanelItems as | panelItem |}}
        {{> @macro/widgets/panel-detail/include-panel.hbs type=panelItem.itemType item=panelItem isMultiData=false panel=page.psViewLayoutPanel page=page}}
        {{/each}}
        {{/if}}
    </div>
    {{/if}}
{{/if}}
</template>
<script setup lang="ts">
// 基于template/src/views/\{{appModules}}/\{{pages@APPINDEXVIEW}}/\{{spinalCase page.codeName}}.vue.hbs生成
{{#if page.psViewLayoutPanel.useDefaultLayout}}
import { AppLayoutTop, AppLayoutLeft } from "@components/layout/app-layout";
{{> @macro/widgets/ctrl/import-ctrl.hbs ctrls=page.ctrls}}
{{else}}
import { AppCtrlPos, AppScrollContainer, AppSimpleFlexContainer, AppStandardContainer, AppTabPanel, AppTabPage } from '@components/layout-element/structure';
{{#if page.psViewLayoutPanel.viewProxyMode}}
{{> @macro/widgets/ctrl/import-ctrl.hbs ctrls=page.psViewLayoutPanel.psControls}}
{{else}}
{{> @macro/widgets/ctrl/import-ctrl.hbs ctrls=page.ctrls}}
{{/if}}
{{/if}}
import { model } from "./{{spinalCase page.codeName}}-model";
import { 
    getIndexViewClassNames, 
    handleCtrlInit, 
    handleCtrlAction, 
    handleCtrlDestroy, 
    useNavParamsBind, 
    useEventBind,
{{#unless page.psViewLayoutPanel.useDefaultLayout}}
    handleComponentAction,
    {{#if page.psViewLayoutPanel.psControls}}
    {{#each page.psViewLayoutPanel.psControls as | ctrl |}}
    {{#eq ctrl.controlType 'TOOLBAR'}}
    handleToolbarItemClick,
    {{/eq}}
    {{/each}}
    {{/if}}
{{/unless}}
} from '@/hooks/use-view';
import { IIndexViewAbility, IIndexViewController, IIndexViewControllerParams, IIndexViewStore, IndexViewActionType, IndexViewController, IParam, ILoadingHelper, IContext, IEvent } from "@/core";

{{> @macro/view/view-props.hbs props="appIconPath?: string"}}

{{> @macro/common/emit.hbs name="view" actionType="IndexViewActionType" ability="IIndexViewAbility"}}

const classNames = computed(() => {
    const classNames = getIndexViewClassNames(model, props);
    Object.assign(classNames, {[`app-vc-menu--${store.mainMenuPosition.toLowerCase()}`]: true});
    return classNames
});

const params: IIndexViewControllerParams<IndexViewActionType, IIndexViewAbility> = {
    name: props.name,
    model, 
    evt,
    isLoadDefault: props.isLoadDefault,
    openType:props.openType, 
    pLoadingHelper:props.pLoadingHelper, 
    handler: (data: IIndexViewStore) => { return reactive(data); } 
};

{{> @macro/common/controller.hbs name="view" IController="IIndexViewController" store="IIndexViewStore" ability="IIndexViewAbility" controller="IndexViewController"}}
</script>